//
//  TWDetailCollectionViewCell.swift
//  EyepetizerImitative
//
//  Created by 田伟 on 2017/3/13.
//  Copyright © 2017年 个人. All rights reserved.
//

import UIKit

class TWDetailCollectionViewCell: UICollectionViewCell {

    @IBOutlet weak var topImageView: UIImageView!
    @IBOutlet weak var titleLabel: UILabel!
    @IBOutlet weak var timeLabel: UILabel!
    @IBOutlet weak var showAllLabel: UILabel!
    

    var model : TWItemModel?{
        didSet {
            guard let model = model else {
                return
            }
            let type = model.dataType!
            if type == VideoBeanForClient {
                showAllLabel.isHidden = true
                topImageView.isHidden = false
                titleLabel.isHidden = false
                timeLabel.isHidden = false
                // 设置控件
                topImageView.sd_setImage(with: URL(string: (model.cover?.detail)!))
                topImageView.contentMode = .scaleAspectFill
                titleLabel.text = model.title
                timeLabel.text = "#\(model.category!)" + " / " + "\(model.duration_tw!)"
            }
            if type == ActionCard {
                showAllLabel.isHidden = false
                topImageView.isHidden = true
                titleLabel.isHidden = true
                timeLabel.isHidden = true
                showAllLabel.text = model.text
            }
        }
    }
    
    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
    }

}

